package com.example.smartcity_ikun3.ui.Smart.view

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MenuItem
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.smartcity_ikun3.R
import com.example.smartcity_ikun3.ui.Smart.adapter.SmartMoreFourRecyclerViewAdapter
import com.example.smartcity_ikun3.ui.Smart.adapter.SmartMoreThreeRecyclerViewAdapter
import com.example.smartcity_ikun3.ui.Smart.model.SmartFourEntity
import com.example.smartcity_ikun3.ui.Smart.model.SmartThreeEntity
import kotlinx.android.synthetic.main.activity_smart_more_four.*

class SmartMoreFourActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        supportActionBar?.setDisplayHomeAsUpEnabled(true)
        setContentView(R.layout.activity_smart_more_four)
        title = "集中监测"

        val array = ArrayList<SmartFourEntity>().apply {
            this.add(
                SmartFourEntity(
                "张大爷",
                R.mipmap.smarttwo1,
                "入住率: 29%",
                "年龄: 79岁",
                "运动量: 70分钟",
                "活动时间: 1.5小时",
                ""
            )
            )

            this.add(
                SmartFourEntity(
                    "李大爷",
                    R.mipmap.smarttwo1,
                    "入住率: 29%",
                    "年龄: 79岁",
                    "运动量: 70分钟",
                    "活动时间: 1.5小时",
                    ""
                )
            )

            this.add(
                SmartFourEntity(
                    "王大爷",
                    R.mipmap.smarttwo1,
                    "入住率: 29%",
                    "年龄: 79岁",
                    "运动量: 70分钟",
                    "活动时间: 1.5小时",
                    ""
                )
            )

            this.add(
                SmartFourEntity(
                    "文大爷",
                    R.mipmap.smarttwo1,
                    "入住率: 29%",
                    "年龄: 79岁",
                    "运动量: 70分钟",
                    "活动时间: 1.5小时",
                    ""
                )
            )

            this.add(
                SmartFourEntity(
                    "黄大爷",
                    R.mipmap.smarttwo1,
                    "入住率: 29%",
                    "年龄: 79岁",
                    "运动量: 70分钟",
                    "活动时间: 1.5小时",
                    ""
                )
            )

            this.add(
                SmartFourEntity(
                    "温大爷",
                    R.mipmap.smarttwo1,
                    "入住率: 29%",
                    "年龄: 79岁",
                    "运动量: 70分钟",
                    "活动时间: 1.5小时",
                    ""
                )
            )
        }

        SmartMoreFourRecyclerView.apply {
            this.layoutManager = LinearLayoutManager(context)
            this.adapter = SmartMoreFourRecyclerViewAdapter(array)
        }

    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        finish()
        return super.onOptionsItemSelected(item)
    }
}